package chapter01;

import java.util.Scanner;

public class Test14_Day2 {
    public static void main(String[] args) {
        //输入年月日 输出天数
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年月日：");
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int day = scanner.nextInt();
        //判断闰年
        boolean flag = year%4==0&&year%100!=0||year%400==0;
        int dayOfYear = 0;
        if(month==1){
            dayOfYear = day;
        }
        if(month==2){
            dayOfYear = 31+day;
        }
        if(month==3){
            dayOfYear = 31+28+day;
        }
        if(month==4){
            dayOfYear = 31+28+31+day;
        }
        if(month==5){
            dayOfYear = 31+28+31+30+day;
        }
        if(month==6){
            dayOfYear = 31+28+31+30+31+day;
        }
        if(month==7){
            dayOfYear = 31+28+31+30+31+30+day;
        }
        if(month==8){
            dayOfYear = 31+28+31+30+31+30+31+day;
        }
        if(month==9){
            dayOfYear = 31+28+31+30+31+30+31+31+day;
        }
        if(month==10){
            dayOfYear = 31+28+31+30+31+30+31+31+30+day;
        }
        if(month==11){
            dayOfYear = 31+28+31+30+31+30+31+31+30+31+day;
        }
        if(month==12){
            dayOfYear = 31+28+31+30+31+30+31+31+30+31+30+day;
        }
        if(flag){
            if(month>2){
                dayOfYear+=1;
            }
        }
        System.out.println("该天是该年的第"+dayOfYear+"天");
    }
}
